home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tcl8.0 / tests / concat.test < prev    next >
Encoding:
Text File  |  1997-08-15  |  1.4 KB  |  47 lines  |  [TEXT/ALFA]

  1. # Commands covered:  concat
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994-1996 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # SCCS: @(#) concat.test 1.10 96/12/20 18:53:31
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. test concat-1.1 {simple concatenation} {
  18.     concat a b c d e f g
  19. } {a b c d e f g}
  20. test concat-1.2 {merging lists together} {
  21.     concat a {b c d} {e f g h}
  22. } {a b c d e f g h}
  23. test concat-1.3 {merge lists, retain sub-lists} {
  24.     concat a {b {c d}} {{e f}} g h
  25. } {a b {c d} {e f} g h}
  26. test concat-1.4 {special characters} {
  27.     concat a\{ {b \{c d} \{d
  28. } "a{ b \\{c d {d"
  29.  
  30. test concat-2.1 {error: one empty argument} {
  31.     concat {}
  32. } {}
  33.  
  34. test concat-3.1 {error: no arguments} {
  35.     list [catch concat msg] $msg
  36. } {0 {}}
  37.  
  38. test concat-4.1 {pruning off extra white space} {
  39.     concat {} {a b c}
  40. } {a b c}
  41. test concat-4.2 {pruning off extra white space} {
  42.     concat x y "  a b c    \n\t  " "   "  " def "
  43. } {x y a b c def}
  44. test concat-4.3 {pruning off extra white space sets length correctly} {
  45.     llength [concat { {{a}} }]
  46. } 1
  47.